<blockquote>
    <p>开始上手撸码</p>
    <footer>写一个全局配置类继承 <code>AntsConfig</code> 初始化全局配置, 默认不加载任何配置</code></footer>
</blockquote>
<div class="clear">AppConfig.java 项目全局配置类</div>
<pre class="code brush:java">
package com.acxy.test;

import com.acxy.ants.core.Jetty;
import com.acxy.ants.core.config.AntsConfig;
import com.acxy.ants.core.config.Constants;
import com.acxy.ants.core.config.Handlers;
import com.acxy.ants.core.config.Plugins;

/**
 * 全局配置
 * @author MrShun
 * @version 1.0
 * @Date 2017-04-26
 */
public class AppConfig extends AntsConfig {


    @Override
    public void configConstant(Constants me) {
        //TODO 常量配置
    }

    @Override
    public void configPlugin(Plugins me) {
        //TODO 插件配置
    }

    @Override
    public void configHandler(Handlers me) {
        //TODO 请求链配置
    }

    public static void main(String[] args) {
        //采用Jetty启动，前提需要配置maven jar
        Jetty.start("ants-test/src/main/webapp", 88, "/test");
    }
}
</pre>
<div class="clear">
    <p>如报以下错误, 则是没有配置jetty </p>
    <img src="/debug/jetty-error.png"/>
    <p>jetty maven 配置</p>
    <pre class="code brush:xml">
        <dependency>
            <groupId>org.eclipse.jetty</groupId>
            <artifactId>jetty-server</artifactId>
            <version>8.1.7.v20120910</version>
        </dependency>
        <dependency>
            <groupId>org.eclipse.jetty</groupId>
            <artifactId>jetty-webapp</artifactId>
            <version>8.1.7.v20120910</version>
        </dependency>
        <dependency>
            <groupId>org.eclipse.jetty</groupId>
            <artifactId>jetty-jsp</artifactId>
            <version>8.1.7.v20120910</version>
        </dependency>
    </pre>
</div>
<div class="clear">web.xml 文件配置</div>
<pre class="code brush:xml">
    <filter>
        <filter-name>AntsFilter</filter-name>
        <filter-class>com.acxy.ants.core.AntsFilter</filter-class>
        <init-param>
            <param-name>configClass</param-name>
            <param-value>com.acxy.test.AppConfig</param-value>
        </init-param>
        <!--<init-param>-->
        <!--<param-name>modules</param-name>-->
        <!--<param-value>/lib/ants-auth-1.0.jar,/lib/ants-b2b2c-1.0.jar</param-value>-->
        <!--</init-param>-->
    </filter>
    <filter-mapping>
        <filter-name>AntsFilter</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>
</pre>
<div class="panel panel-default clear">
    <div class="panel-body">
        <b style="color:blue">提示</b>：以上注释部分有个 <code>modules</code> 参数是用来加载其他模块, 就像Spring那样可以模块之间的依赖
    </div>
</div>
<div class="clear">TestController.java 写个简单控制器运行下, 控制层详解请查看@Controller</div>
<pre class="code brush:java">
package com.acxy.test.ajax;

import com.acxy.ants.resful.annotation.Controller;
import com.acxy.ants.resful.annotation.GET;

/**
 * 测试控制器类
 * @author MrShun
 * @version 1.0
 * @Date 2017-10-24
 */
@Controller("api")
public class TestController {

    @GET("/test")
    public Object test(String name) {
        return name + " ants is ok!";
    }
}
</pre>
<div class="clear">
    <p>运行后的效果, 测试成功! </p>
    <p style="margin-bottom: 100px;"><img src="/debug/ants-ok.png"/></p>
</div>
<script type="text/javascript">
    $(function () {
        SyntaxHighlighter.highlight();
        $(".toolbar").remove();
    });
</script>